<%-- 
    Document   : cassiera_jsp
    Created on : 3-mar-2012, 15.58.47
    Author     : alexcarpentieri
--%>

<%@page import="ejb.Cliente"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="ejb.Cassiere" %>
<%Cassiere cassa = (Cassiere) session.getAttribute("cassa");
  Cliente cliente = (Cliente) session.getAttribute("cliente");
%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>CASSA</title>
    </head>
    <body>
        <h1> CASSA</h1>
        <div class="login_cassiere">
            <%if (cassa != null) {%>
            Sei loggato come: <%=cassa.getNameUser()%>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="logout"/>
                <input type="submit" value="LOGOUT"/>
            </form>
            <div class="codice_a_barre">
                <%if (cliente == null) {%>
                <form action="ServletMain" method="POST" name="codice_a_barre">

                    <input type="hidden" name="op" value="loginCodiceABarre"/>
                    <table>
                        <tr><td>codice a barre:</td><td><input name="codiceABarre" type="text"/></td></tr>
                    </table>
                </form>

                <%} else {%>
                <form action="ServletMain" method="POST" name="codice_a_barre">

                    Carica i punti sulla tessera del cliente <%=cliente.getNome() + " " + cliente.getCognome() + ""%>                    
                    <input type="submit" value="nuovo cliente"/>
                    <input type="hidden" name="op" value="nuovoClienteAllaCassa"/>
                </form>
                <form action="ServletMain" method="POST" name="raccogli punti">
                    <input name="punti" type="text"/>
                    <input type="submit" value="aggiungi punti"/>
                    <input type="hidden" name="op" value="aggiungiPunti"/>
                </form>
                <%}%>
            </div>
            <%if (cliente == null) {%>
            <div class="compila_scontrino">

            </div>
            <%}%>
            <%} else {%>
            <h3>Login</h3>
            <form action="ServletMain" method="POST" name="dati">
                <input type="hidden" name="op" value="loginCassa"/>
                <table>
                    <tr><td>User:</td><td><input name="username" type="text"/></td></tr>
                    <tr><td>Password:</td><td><input name="password" type="password"/></td></tr>
                    <tr><td>&nbsp;</td><td><input type="submit" value="LOGIN"/></td></tr>
                </table>
            </form>
            <%}%>
        </div>

    </body>
</html>
